package cn.edu.zzuli.nothinglink.controller;

import cn.edu.zzuli.nothinglink.entity.R;
import cn.edu.zzuli.nothinglink.utils.AliOssUtils;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/img")
public class ImgController {
    @Resource
    AliOssUtils ossUtils;

    @PutMapping("/put/{fileName}/{type}")
    public R getPutFileUrl(@PathVariable("fileName") String fileName,
                           @PathVariable("type") String type) {
        System.out.println(fileName + "." + type);
        return R.success().add("URL", ossUtils.getPutUrl(fileName + "."+ type));
    }

}
